package a20.com.yuejian_20.adapter;

import android.content.Context;
import android.graphics.Bitmap;
import android.hardware.Camera;
import android.net.Uri;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.squareup.picasso.Picasso;

import org.w3c.dom.Text;

import java.io.File;
import java.util.List;

import a20.com.yuejian_20.R;
import a20.com.yuejian_20.bean.ClubPicture;
import a20.com.yuejian_20.model.ClubModel;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

/**
 * Created by neusoft on 2017/9/29.
 */

public class ClubListAdapter extends ArrayAdapter {
     List<ClubPicture> list;
     Context a;

    public ClubListAdapter(Context context, int resource,  List<ClubPicture> objects) {
        super(context, resource, objects);
        list = objects;
        a = context;
    }

    @NonNull
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        View view = LayoutInflater.from(a).inflate(R.layout.cardview,null);

        ClubPicture clubPicture = list.get(position);
        ImageView imageView3 =(ImageView) view.findViewById(R.id.imageView3) ;
        TextView name =(TextView) view.findViewById(R.id.name) ;
        name.setText(clubPicture.getClubname());
        Picasso.with(a).load("http://10.0.2.2/YueJian/Public/photo/club/"+clubPicture.getClubpic()).fit().into(imageView3);



//
//        Button btn = (Button)findViewById(R.id.imageView);
//        btn.setOnClickListener(new onClickListener){
//
//         public void onClick(View v){
//                Intent intent = new Intent(ClubFragment.this, ClubdetailActivity.class);
//                startActivity(intent);
//            }
//
//
//        }




        return view;
    }
}
